import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
import { getWeekMonthQuarterYear } from '/@/utils';
import {lists} from './ExamQuestions.api'
//列表数据
export const columns: BasicColumn[] = [
  //  {
  //   title: '题库ID',
  //   align:"center",
  //   dataIndex: 'bankId'
  //  },
   {
    title: '题目内容',
    align:"center",
    dataIndex: 'content'
   },
   {
    title: '是否为多选题 (布尔值)',
    align:"center",
    dataIndex: 'isMultipleChoice',
    customRender: ({ text }) => (text === 0 ? '否' : '是'), // 处理0和1的显示
   },
   {
    title: '题目分值',
    align:"center",
    dataIndex: 'valueOfScore'
   },
   {
    title: '正确答案',
    align:"center",
    dataIndex: 'correctAnswer'
   },
   {
    title: '题目类型',
    align:"center",
    dataIndex: 'isPublic',
    customRender: ({ text }) => {
      if (text === 0) {
          return '计分题'; // 对应于状态0
      } else if (text === 1) {
          return '基础信息题'; // 对应于状态1
      } else if (text === 2) {
          return '调查问卷题'; // 对应于状态2
      }else if (text === 3) {
        return '关联题'; // 对应于状态2
    }
    },
   },
  //  {
  //   title: '扩展字段',
  //   align:"center",
  //   dataIndex: 'other'
  //  },
  //  {
  //   title: '扩展字段2',
  //   align:"center",
  //   dataIndex: 'other2'
  //  },
];

//子表表格配置
export const examOptionsColumns: JVxeColumn[] = [
    // {
    //   title: '题库id',
    //   key: 'bankId',
    //   type: JVxeTypes.inputNumber,
    //   width:"200px",
    //   placeholder: '请输入${title}',
    //   defaultValue:'',
    //     validateRules: [
    //       { required: true, message: '${title}不能为空' },
    //     ],
    // },
    // {
    //   title: '题目ID',
    //   key: 'questionId',
    //   type: JVxeTypes.inputNumber,
    //   width:"200px",
    //   placeholder: '请输入${title}',
    //   defaultValue:'',
    //     validateRules: [
    //       { required: true, message: '${title}不能为空' },
    //     ],
    // },
    {
      title: '选项内容',
      key: 'content',
      type: JVxeTypes.input,
      width:"250px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '是否为正确选项',
      key: 'isCorrect',
      type: JVxeTypes.select,
      width:"200px",
      placeholder: '请输入${title}',
      options: [
        { title: '是', value: '1' },
        { title: '否', value: '0' },
      ],
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    // {
    //   title: '扩展字段',
    //   key: 'other',
    //   type: JVxeTypes.input,
    //   width:"200px",
    //   placeholder: '请输入${title}',
    //   defaultValue:'',
    // },
    // {
    //   title: '扩展字段2',
    //   key: 'other2',
    //   type: JVxeTypes.input,
    //   width:"200px",
    //   placeholder: '请输入${title}',
    //   defaultValue:'',
    // },
    {
      title: '选项序列号',
      key: 'number',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
        validateRules: [
          { required: true, message: '${title}不能为空' },
        ],
    },
    {
      title: '关联题目',
      key: 'otherStr',
      type: JVxeTypes.select,
      width:"250px",
      placeholder: '请输入${title}',
      options: [],
      defaultValue:'',
    },
  ]

// 高级查询数据
export const superQuerySchema = {
  bankId: {title: '题库ID',order: 0,view: 'number', type: 'number',},
  content: {title: '题目内容',order: 1,view: 'textarea', type: 'string',},
  isMultipleChoice: {title: '是否为多选题 (布尔值)',order: 2,view: 'number', type: 'number',},
  valueOfScore: {title: '题目分值',order: 3,view: 'number', type: 'number',},
  correctAnswer: {title: '正确答案',order: 4,view: 'text', type: 'string',},
  // other: {title: '扩展字段',order: 5,view: 'text', type: 'string',},
  // other2: {title: '扩展字段2',order: 6,view: 'text', type: 'string',},
  //子表高级查询
  examOptions: {
    title: 'exam_options（题目内容子表）',
    view: 'table',
    fields: {
        bankId: {title: '题库id',order: 0,view: 'number', type: 'number',},
        questionId: {title: '题目ID',order: 1,view: 'number', type: 'number',},
        content: {title: '选项内容',order: 2,view: 'text', type: 'string',},
        isCorrect: {title: '是否为正确选项 (布尔值)',order: 3,view: 'number', type: 'number',},
        // other: {title: '扩展字段',order: 4,view: 'text', type: 'string',},
        // other2: {title: '扩展字段2',order: 5,view: 'text', type: 'string',},
        number: {title: '选项序列号',order: 6,view: 'text', type: 'string',},
    }
  },
};
